#!/usr/bin/env python
#coding=gbk
import sqlite3

def create_sqlite(sqlite_name):
    conn = sqlite3.connect(sqlite_name)
    conn.isolation_level = None
    conn.execute('CREATE  TABLE  IF NOT EXISTS "main"."article" ("id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , "link_name" VARCHAR, "link_url" VARCHAR, "category_id" INTEGER, "analyzed" BOOL)')
    conn.execute('CREATE  TABLE IF NOT EXISTS "main"."category" ("id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , "name" VARCHAR , "url" VARCHAR)')
    conn.execute('CREATE  TABLE IF NOT EXISTS "main"."pic" ("id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , "article_id" INTEGER , "url" VARCHAR, "has_down" BOOL, "save_path" VARCHAR)')
    conn.execute('CREATE  TABLE  IF NOT EXISTS "main"."category_page" ("id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , "category_id" INTEGER, "link_name" VARCHAR, "link_url" VARCHAR, "analyzed" BOOL)')
    conn.commit()
    conn.close()

if __name__ == '__main__':
    create_sqlite("pic_download.sqlite")
